/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * Principal.java
 *
 * Created on 12/06/2009, 18:08:45
 */

package Negocios;

import java.sql.SQLException;
import javax.swing.JOptionPane;

/**
 *
 * @author Administrador
 */
public class Principal extends javax.swing.JFrame {

  public java.sql.Connection OracleCon;
  public java.sql.Connection conexãoJDBC;
  
            
    CadastrarEquipe f1;
    ConsultarEquipe f2;// = new ConsultarEquipe();
    CadastrarAluno f3;// = new CadastrarAluno();
    ConsultarAluno f4;// = new ConsultarAluno();
    OpcoesFutebolSalao f5;// = new OpcoesFutebolSalao();
    /** Creates new form Principal */
    public Principal() {
    initComponents();
  }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        desktopPane = new javax.swing.JDesktopPane();
        PlanoDeFundojLabel = new javax.swing.JLabel();
        menuBar = new javax.swing.JMenuBar();
        CompeticoesJMenu = new javax.swing.JMenu();
        CriarCompeticoesJMenuItem = new javax.swing.JMenuItem();
        DeletarCompeticoesjMenu = new javax.swing.JMenu();
        EquipesjMenu = new javax.swing.JMenu();
        CadastrarEquipesjMenuItem = new javax.swing.JMenuItem();
        ConsultarEquipesjMenuItem = new javax.swing.JMenuItem();
        AlunosjMenu = new javax.swing.JMenu();
        CadastrarAlunosjMenuItem = new javax.swing.JMenuItem();
        ConsultarAlunosjMenuItem = new javax.swing.JMenuItem();
        FutebolSalaojMenu = new javax.swing.JMenu();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        setTitle("S.I.C.E.");
        setBackground(new java.awt.Color(0, 0, 0));
        addWindowListener(new java.awt.event.WindowAdapter() {
            public void windowClosed(java.awt.event.WindowEvent evt) {
                formWindowClosed(evt);
            }
            public void windowOpened(java.awt.event.WindowEvent evt) {
                formWindowOpened(evt);
            }
        });

        PlanoDeFundojLabel.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        PlanoDeFundojLabel.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Imagens/001.jpg"))); // NOI18N
        PlanoDeFundojLabel.setText("jLabel1");
        PlanoDeFundojLabel.setBounds(130, 0, 1020, 630);
        desktopPane.add(PlanoDeFundojLabel, javax.swing.JLayeredPane.DEFAULT_LAYER);

        menuBar.setBackground(new java.awt.Color(0, 0, 0));
        menuBar.setForeground(new java.awt.Color(51, 255, 51));

        CompeticoesJMenu.setBackground(new java.awt.Color(0, 0, 0));
        CompeticoesJMenu.setForeground(new java.awt.Color(255, 255, 255));
        CompeticoesJMenu.setText("Competições");

        CriarCompeticoesJMenuItem.setBackground(new java.awt.Color(0, 0, 0));
        CriarCompeticoesJMenuItem.setForeground(new java.awt.Color(255, 255, 255));
        CriarCompeticoesJMenuItem.setText("Criar");
        CompeticoesJMenu.add(CriarCompeticoesJMenuItem);

        DeletarCompeticoesjMenu.setBackground(new java.awt.Color(0, 0, 0));
        DeletarCompeticoesjMenu.setForeground(new java.awt.Color(255, 255, 255));
        DeletarCompeticoesjMenu.setText("Deletar");
        CompeticoesJMenu.add(DeletarCompeticoesjMenu);

        menuBar.add(CompeticoesJMenu);

        EquipesjMenu.setBackground(new java.awt.Color(0, 0, 0));
        EquipesjMenu.setForeground(new java.awt.Color(255, 255, 255));
        EquipesjMenu.setText("Equipes");

        CadastrarEquipesjMenuItem.setBackground(new java.awt.Color(0, 0, 0));
        CadastrarEquipesjMenuItem.setForeground(new java.awt.Color(255, 255, 255));
        CadastrarEquipesjMenuItem.setText("Cadastrar");
        CadastrarEquipesjMenuItem.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                CadastrarEquipesjMenuItemActionPerformed(evt);
            }
        });
        EquipesjMenu.add(CadastrarEquipesjMenuItem);

        ConsultarEquipesjMenuItem.setBackground(new java.awt.Color(0, 0, 0));
        ConsultarEquipesjMenuItem.setForeground(new java.awt.Color(255, 255, 255));
        ConsultarEquipesjMenuItem.setText("Consultar");
        ConsultarEquipesjMenuItem.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                ConsultarEquipesjMenuItemActionPerformed(evt);
            }
        });
        EquipesjMenu.add(ConsultarEquipesjMenuItem);

        menuBar.add(EquipesjMenu);

        AlunosjMenu.setBackground(new java.awt.Color(0, 0, 0));
        AlunosjMenu.setForeground(new java.awt.Color(255, 255, 255));
        AlunosjMenu.setText("Alunos");

        CadastrarAlunosjMenuItem.setBackground(new java.awt.Color(0, 0, 0));
        CadastrarAlunosjMenuItem.setForeground(new java.awt.Color(255, 255, 255));
        CadastrarAlunosjMenuItem.setText("Cadastrar");
        CadastrarAlunosjMenuItem.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                CadastrarAlunosjMenuItemActionPerformed(evt);
            }
        });
        AlunosjMenu.add(CadastrarAlunosjMenuItem);

        ConsultarAlunosjMenuItem.setBackground(new java.awt.Color(0, 0, 0));
        ConsultarAlunosjMenuItem.setForeground(new java.awt.Color(255, 255, 255));
        ConsultarAlunosjMenuItem.setText("Consultar");
        ConsultarAlunosjMenuItem.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                ConsultarAlunosjMenuItemActionPerformed(evt);
            }
        });
        AlunosjMenu.add(ConsultarAlunosjMenuItem);

        menuBar.add(AlunosjMenu);

        FutebolSalaojMenu.setBackground(new java.awt.Color(0, 0, 0));
        FutebolSalaojMenu.setForeground(new java.awt.Color(255, 255, 255));
        FutebolSalaojMenu.setText("Futebol de Salão");
        FutebolSalaojMenu.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                FutebolSalaojMenuActionPerformed(evt);
            }
        });
        menuBar.add(FutebolSalaojMenu);

        setJMenuBar(menuBar);

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(desktopPane, javax.swing.GroupLayout.DEFAULT_SIZE, 1262, Short.MAX_VALUE)
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(desktopPane, javax.swing.GroupLayout.DEFAULT_SIZE, 701, Short.MAX_VALUE)
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void CadastrarEquipesjMenuItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_CadastrarEquipesjMenuItemActionPerformed
        f1.setVisible(true);

}//GEN-LAST:event_CadastrarEquipesjMenuItemActionPerformed

    private void ConsultarEquipesjMenuItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_ConsultarEquipesjMenuItemActionPerformed
  
        f2.setVisible(true);
}//GEN-LAST:event_ConsultarEquipesjMenuItemActionPerformed

    private void CadastrarAlunosjMenuItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_CadastrarAlunosjMenuItemActionPerformed
       f3.setVisible(true);
}//GEN-LAST:event_CadastrarAlunosjMenuItemActionPerformed

    private void ConsultarAlunosjMenuItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_ConsultarAlunosjMenuItemActionPerformed
        f4.setVisible(true);
}//GEN-LAST:event_ConsultarAlunosjMenuItemActionPerformed

private void FutebolSalaojMenuActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_FutebolSalaojMenuActionPerformed
        f5.setVisible(true);
}//GEN-LAST:event_FutebolSalaojMenuActionPerformed

private void formWindowOpened(java.awt.event.WindowEvent evt) {//GEN-FIRST:event_formWindowOpened
 try{
           //Comando que conecta ao Oracle
            Conexão.Conectar("hr", "hr");
            f1  = new CadastrarEquipe();
            f2 = new ConsultarEquipe();
            f3 = new CadastrarAluno();
            f4 = new ConsultarAluno();
            f5 = new OpcoesFutebolSalao();
            
            desktopPane.add(f1);
            desktopPane.add(f2);
            desktopPane.add(f3);
            desktopPane.add(f4);
            desktopPane.add(f5);
            
        }catch (Exception ex){
            JOptionPane.showMessageDialog(
            this,
            "Erro: " + ex.getMessage(),
            "Erro",
            JOptionPane.ERROR_MESSAGE);
            System.exit(0);
        }
}//GEN-LAST:event_formWindowOpened

private void formWindowClosed(java.awt.event.WindowEvent evt) {//GEN-FIRST:event_formWindowClosed
 try{
            Conexão.Desconectar();
        }catch (SQLException ex){
            JOptionPane.showMessageDialog(
            this,
            "Erro[Instrução SQL inválida]"+ex.getMessage(),
            "Erro",
            JOptionPane.ERROR_MESSAGE);

        }
}//GEN-LAST:event_formWindowClosed

    /**
    * @param args the command line arguments
    */
    public static void main(String args[]) {
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                new Principal().setVisible(true);


            }
        });
    }

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JMenu AlunosjMenu;
    private javax.swing.JMenuItem CadastrarAlunosjMenuItem;
    private javax.swing.JMenuItem CadastrarEquipesjMenuItem;
    private javax.swing.JMenu CompeticoesJMenu;
    private javax.swing.JMenuItem ConsultarAlunosjMenuItem;
    private javax.swing.JMenuItem ConsultarEquipesjMenuItem;
    private javax.swing.JMenuItem CriarCompeticoesJMenuItem;
    private javax.swing.JMenu DeletarCompeticoesjMenu;
    private javax.swing.JMenu EquipesjMenu;
    private javax.swing.JMenu FutebolSalaojMenu;
    private javax.swing.JLabel PlanoDeFundojLabel;
    private javax.swing.JDesktopPane desktopPane;
    private javax.swing.JMenuBar menuBar;
    // End of variables declaration//GEN-END:variables

}
